#pragma once
/**
 * @brief 内部用，just for sports_mode_store_internal.c
 * 
 * @file sports_mode_store_internal.h
 * @author your name
 * @date 2018-06-13
 */
#ifndef __SPORTS_MODE_STORE_INTERNAL_H__
#define __SPORTS_MODE_STORE_INTERNAL_H__
#include <sports_mode_cfg.h>
#include <sports_mode.h>
#include <platform_assert.h>
#ifdef SPORTS_MODE_STORE_INTERNAL

typedef struct __sports_mode_store_internal_data_t
{
    sports_mode_summary_info_t summary;
    sports_mode_detail_t detail_info[SPORTS_MODE_DETAIL_CACHE_COUNT];
} sports_mode_store_internal_data_t;
typedef struct __sports_mode_store_internal_item_t
{
    //!< sports_mode_summary_info_t summay must be first member
    sports_mode_store_internal_data_t data;
    sports_mode_id_t id;
} sports_mode_store_internal_item_t;


PLATFORM_STATIC_ASSERT(sizeof(sports_mode_store_internal_item_t) == sizeof(sports_mode_summary_info_t) + sizeof(sports_mode_detail_t) * SPORTS_MODE_DETAIL_CACHE_COUNT + sizeof(sports_mode_id_t), "sports_mode_store_internal_item_t size error");
#define SPORTS_MODE_STORE_INTERNAL_PAGE_CNT (3)     //!< 一共使用多少页page来存储运动模式
#define SPORTS_MODE_STORE_INTERNAL_STORE_COUNT (10) //!< 保留最近多少次运动模式的数据

#define SPORTS_MODE_STORE_INTERNAL_PAGE_SIZE (4096)

//PLATFORM_STATIC_ASSERT(&(((sports_mode_store_internal_item_t*)0)->data.summary) == 0, "summay must be first member");
PLATFORM_STATIC_ASSERT(SPORTS_MODE_STORE_INTERNAL_PAGE_SIZE >= sizeof(sports_mode_store_internal_item_t) * SPORTS_MODE_STORE_INTERNAL_STORE_COUNT, "SPORTS_MODE_STORE_INTERNAL_STORE_COUNT wrong");
PLATFORM_STATIC_ASSERT(SPORTS_MODE_STORE_INTERNAL_PAGE_SIZE % sizeof(sports_mode_store_internal_item_t) == 0, "sports_mode_store_internal_item_t size wrong");
#endif                                              //!<#ifdef SPORTS_MODE_STORE_INTERNAL
#endif                                              //!<__SPORTS_MODE_STORE_INTERNAL_H__
